//后台的跳转接口
const axios=require('axios')
const express=require('express')
const router=express.Router()
//权限页面
router.get('/admin/supercell',(req,res)=>{
    res.render('../views/supercell.art')
})
//普通用户
router.get('/admin/users',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/users.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//管理员
router.get('/admin/admin',(req,res)=>{
    if(req.secure.userMessage!=undefined||req.session.userMessage.permission=='SUPERMAN'){
        res.render('../views/admin/admin.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//专辑管理
router.get('/admin/album',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/album.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//专辑审核
router.get('/admin/checkAlbum',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/checkAlbum.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//文章审核
router.get('/admin/checkArticle',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/checkArticle.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//内容管理
router.get('/admin/container',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/container.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//首页轮播图管理
router.get('/admin/figure',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        axios.get('http://101.35.138.144:8080/image/Admin/Slideshow/queery')
        .then(data=>{
            console.log(data.data.data)
            let list = data.data.data
            res.render('../views/admin/figure.art',{list})
        })
        .catch(err=>{
            console.log(err)
        })
    }else{
        res.render('../views/supercell.art')
    }
})
//一级分类
router.get('/admin/firstClass',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/firstClass.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//栏目管理
router.get('/admin/programa',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/programa.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//文章举报
router.get('/admin/reportArticle',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/reportArticle.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//评论举报
router.get('/admin/reportComment',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/reportComment.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//用户举报
router.get('/admin/reportUsers',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/reportUsers.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//二级分类
router.get('/admin/sencondClass',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/sencondClass.art')
    }else{
        res.render('../views/supercell.art')
    }
})
//账号设置
router.get('/picture/account',(req,res)=>{
    res.render('../views/admin/account.art')
})
//cropper
router.get('/admin/corpper',(req,res)=>{
    if(req.session.userMessage!=undefined||req.session.userMessage.permission!='NORMAL'){
        res.render('../views/admin/corpper.art')
    }else{
        res.render('../views/supercell.art')
    }
})
module.exports=router